import allure
from selenium.webdriver.common.by import By

from key_word.key_word import KeyWord


class BannerPage(KeyWord):
    # 点击导航栏
    def click_banner(self, first_banner, second_banner):
        with allure.step("点击导航栏"):
            # 导航栏-商品
            page_home_bar_goods = [By.XPATH, f"//ul[@id='main_menu']/.//span[text()='{first_banner}']/../.."]
            # 导航栏-商品列表
            page_home_bar_goods_list = [By.XPATH, f"//span[text()='{second_banner}']/../.."]
            # 点击导航栏-商品
            self.click_el_until_visibility(*page_home_bar_goods)
            # 点击导航栏-商品列表
            self.click_el_until_visibility(*page_home_bar_goods_list)
